package com.hxalex.simulationhandle.ui.home.model;

import com.hxalex.simulationhandle.common.BaseModel;
import com.hxalex.simulationhandle.db.DaoSession;
import com.hxalex.simulationhandle.db.KeyWordBeanDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToOne;

import java.io.Serializable;
import com.hxalex.simulationhandle.db.TaskBeanDao;

/**
 * Created by hx_Alex on 2018/5/22.
 * 关键词库实体bean
 */
@Entity
public class KeyWordBean extends BaseModel implements Serializable {
    private static final long serialVersionUID = 2552429215424205490L;
    @Id(autoincrement = true)
    private Long keyWordId;
    private String keyWordString;
    private Long taskId;
    @ToOne(joinProperty = "taskId")
    private TaskBean taskBean;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 2067138059)
    private transient KeyWordBeanDao myDao;

    @Generated(hash = 1118346228)
    public KeyWordBean(Long keyWordId, String keyWordString, Long taskId) {
        this.keyWordId = keyWordId;
        this.keyWordString = keyWordString;
        this.taskId = taskId;
    }
    public KeyWordBean(String keyWordString) {
        this.keyWordString = keyWordString;
    }

    @Generated(hash = 673900408)
    public KeyWordBean() {
    }

    @Generated(hash = 823051443)
    private transient Long taskBean__resolvedKey;

    public Long getKeyWordId() {
        return keyWordId;
    }

    public void setKeyWordId(Long keyWordId) {
        this.keyWordId = keyWordId;
    }

    public String getKeyWordString() {
        return keyWordString;
    }

    public void setKeyWordString(String keyWordString) {
        this.keyWordString = keyWordString;
    }
   @Keep
    public TaskBean getTaskBean() {
        return taskBean;
    }
    
    @Keep
    public void setTaskBean(TaskBean taskBean) {
        this.taskBean = taskBean;
    }

    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1614059898)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getKeyWordBeanDao() : null;
    }
}
